package originatorV3;

import command.Command;

import mementoV2.CopierMemento;
import mementoV2.Memento;
import mementoV3.CopierMementoV3;
import mementoV3.MementoV3;
import originatorV2.CopierOriginator;
import caretakerV3.GestionDefaire;

public class CopierOriginatorV3 implements OriginatorV3 {

	public CopierOriginatorV3(Command command, GestionDefaire _gestion) {
		super();
		this._copier = command;
		this._gestion = _gestion;
	}
	@Override
	public void execute() {
		((CopierOriginator)_copier).execute();
		MementoV3 m =new CopierMementoV3(this);
		_gestion.sauvegarder(m);
	}

	private Command _copier;
	private GestionDefaire _gestion;
	@Override
	public void setMemento(MementoV3 m) {
		Memento mem = new CopierMemento((CopierOriginator) _copier);
		((CopierOriginator) _copier).setMemento(mem);
	}

}
